home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / MOVEDAT1.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  726 b   |  19 lines

  1. /* mvedata1.c, from p.157 of Turbo C Bible  */
  2. /* Copies a specified number of bytes of a buffer to a another
  3.          in possibly different segment. */
  4. #include <stdio.h>
  5. #include <dos.h>                       /* For FP_OFF and FP_SEG  */
  6. #include <mem.h>
  7. static char buffer[41];                /* Destination buffer */
  8. main()
  9. {
  10.     void far *address;
  11.     unsigned bufseg, bufoff;
  12.     address = (void far *)buffer;/* Get segment and offset address */
  13.     bufseg = FP_SEG(address);    /*                     of buffer  */
  14.     bufoff = FP_OFF(address);
  15.     movedata(0xf000, 0xe000, bufseg, bufoff, 22);
  16.     buffer[22] = '\0';
  17.         /* Use the 'F' address modifier when printing buffer */
  18.     printf("The buffer now contains: %s\n", buffer);
  19. }